﻿<?xml version="1.0" encoding="utf-8"?>
<developerOrientationDocument
  xmlns="http://ddue.schemas.microsoft.com/authoring/2003/5"
  xmlns:xlink="http://www.w3.org/1999/xlink">

  <content>
  	<mediaLink>
		<caption>AeroGlassProvider</caption>
		<image placement="center" xlink:href="16da4a17-b806-4391-8bb0-b93e011afccc"/>
	</mediaLink>

  	<para><ui>Welcome to the AeroGlassProvider:</ui> the .NET framework does not supply
  	an easy method to extend the Aero glass into the client area of a form. Calls
  	must be made into the unmanaged Desktop Window Manager API and UxTheme. Furthermore,
  	the glass is rendered on top of a black brush. This means that any control placed
  	onto the glass will have it's black surfaces rendered as glass. So you end up using
  	owner draw controls or painting	text and images directly onto the glass.</para>
  	
  	<para>In order to simplify this process, I created the AeroGlassProvider. The AeroGlassProvider
  	implements an IExtenderProvider interface to extend three different UI elements:</para>
  	<list class="bullet">
  	<listItem>Form: provides properties <codeInline>GlassEnabled</codeInline>, 
  	<codeInline>GlassMargins</codeInline>, and <codeInline>GlassTopMovesForm</codeInline>.</listItem>
  	<listItem>Label, PictureBox: provides properties <codeInline>OnGlass</codeInline>,
  	<codeInline>GlassTextGlowSize</codeInline>.</listItem>
	<listItem>LabelControl: Since I use Developer Express controls the LabelControl
	is extended identical to Label.</listItem>
  	</list>
  	
  	<para>To use the provider place an AeroGlassProvider onto a form. The form will then provide
  	three additional properties. The most prominant is <codeInline>GlassMargins</codeInline>.
  	Setting the <codeInline>GlassMargins</codeInline> Top value to 100 will extend the glass down
  	into the client area 100 pixels. The example show a top margin of 100 and a bottom margin of 30.</para>
  	<mediaLink>
		<caption>GlassMargin property</caption>
		<image placement="center" xlink:href="dc5db445-bf72-4578-9563-97da3506f02c"/>
	</mediaLink>
	
	<para>Notice that the client area to be glassed is painted in black. The non-black area
	is the surface that you can work within. Note that docking a control to the top or bottom
	in this example will cause the docked control to enter the glass area.</para>

  	<para>The other two properties specific to the form are <codeInline>GlassEnabled</codeInline>
  	and <codeInline>GlassTopMovesForm</codeInline>.</para>
  	<mediaLink>
		<caption>Other form specific properties</caption>
		<image placement="center" xlink:href="d9bae1a2-1082-4bae-86ac-a018a34a6f27"/>
	</mediaLink>
  	
  	<para>The <codeInline>GlassEnabled</codeInline> property will enable or disable
  	the glass property. This property must be set before form is shown. Changing the property 
  	after the form is shown will have no effect.</para>
  	<para>The <codeInline>GlassTopMovesForm</codeInline> allows the glass area in the top
  	margin to act as an extension of the caption in that clicking and dragging will move
  	the form. To do this you must set the <codeInline>GlassTopMovesForm</codeInline> to 
  	<codeInline>true</codeInline> and then have a WndProc method in your form similar to:</para>
  	
<code language="C#">
<![CDATA[
protected override void WndProc(ref Message message)
{
    base.WndProc(ref message);
    aeroGlassProvider.WndProc(this, ref message);
}
]]>
</code>

  	<alert class="warning"><para>Setting the forms <codeInline>DoubledBuffered</codeInline> property to true is not supported.</para></alert>
  	<alert class="warning"><para>Placing the AeroGlassProvider onto a UserControl is not supported.</para></alert>
  </content>

  <relatedTopics>
  </relatedTopics>
</developerOrientationDocument>
